package xyz.liut.ee.api

import jakarta.servlet.annotation.MultipartConfig
import jakarta.servlet.annotation.WebServlet
import jakarta.servlet.http.HttpServletRequest
import jakarta.servlet.http.HttpServletResponse
import xyz.liut.ee.req.getSimpleReqInfo
import xyz.liut.ee.resp.ResponseEntity
import xyz.liut.ee.resp.sendBy
import xyz.liut.ee.web.BaseNoDefaultServlet

/**
 * 回响
 *
 * 把请求参数返回过去
 */
@WebServlet("/echo")
@MultipartConfig
class Echo : BaseNoDefaultServlet() {

    override fun service(req: HttpServletRequest, resp: HttpServletResponse) {
        super.service(req, resp)

        val reqInfo = req.getSimpleReqInfo()

        val respBean = ResponseEntity(
            msg = "回响",
            code = 200,
            data = reqInfo
        )
        respBean.sendBy(resp)

    }

}
